<template>
  <view :style="{ marginTop: marginTop }">
    <view class="article-card-v2">
      <view class="article-card-img-wrap">
        <image
          class="article-card-img"
          :src="formatImgUrl(info.coverImgUrl || info.enterpriseLogo)"
          mode="aspectFill"
          :style="{ background: '#4D98FF' }"
        />
      </view>
      <view class="article-card-content">
        <view class="article-card-title">
          {{ info.articleName || info.enterpriseName }}
        </view>
        <view>
          <view class="article-card-row">
            <text class="article-card-icon user-icon"></text>
            <text class="article-card-label">负责人：</text>
            <text class="article-card-value"
              >{{ info.personChargeName }} {{ info.personChargePhone }}</text
            >
          </view>
          <view class="article-card-row">
            <text class="article-card-icon address-icon"></text>
            <text class="article-card-value">{{ info.contactAddress }}</text>
          </view>
        </view>
      </view>
    </view>
    <view class="article-card-divider"></view>
  </view>
</template>

<script>
  import { formatImgUrl } from '../common/utils.js'
  export default {
    name: 'ArticleCardV2',
    props: {
      info: Object,
      marginTop: {
        type: String,
        default: '0rpx'
      }
    },
    methods: {
      formatImgUrl
    }
  }
</script>

<style lang="scss" scoped>
  .article-card-v2 {
    display: flex;
    flex-direction: row;
    background: #fff;
    margin: 20rpx 30rpx;
    overflow: hidden;
  }
  .article-card-img-wrap {
    height: 160rpx;
    background: #4d98ff;
    border-radius: 12rpx;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .article-card-img {
    width: 260rpx;
    height: 160rpx;
    object-fit: cover;
    display: block;
  }

  .article-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-left: 28rpx;
  }
  .article-card-title {
    font-weight: 600;
    font-size: 34rpx;
    color: #333333;
    word-break: break-all;
  }
  .article-card-row {
    display: flex;
  }
  .article-card-label {
    font-size: 24rpx;
    color: #666666;
    margin-right: 8rpx;
    margin-bottom: 8rpx;
  }
  .article-card-value {
    font-size: 24rpx;
    color: #666666;
    word-break: break-all;
  }
  .article-card-icon {
    width: 32rpx;
    height: 32rpx;
    margin-right: 8rpx;
    display: inline-block;
    background-size: cover;
    background-repeat: no-repeat;
  }
  .user-icon {
    background-image: url('/static/icon/admin_icon.png');
  }
  .address-icon {
    background-image: url('/static/icon/map_icon.png');
  }
  .article-card-divider {
    height: 1rpx;
    background: #eaeaea;
    margin: 0 30rpx;
  }
</style>
